<?php 
namespace app\admin\controller;
use think\Request;
use app\common\controller\Base;
use app\common\model\Article as news;
use app\common\model\Category;
/**
 * @Author: YeMiao
 * @Date:   2017-08-12 15:35:33
 * @Last Modified by:   YeMiao
 * @Last Modified time: 2017-09-18 16:04:13
 */
class Article extends Base{

	public function index(){
		$news = new news();		
		$list = $news->get_list();
		$this->assign('list',$list);
		return $this->fetch();
	}
	// 添加页面
	public function article_add(){	
		if(input('post.')){
			$new = new news();
			$add = $new->add_article(input('post.'));
			return $add;
		}else{
			$cate = new Category();
			$list = $cate->get_list();
			$this->assign('list',$list);				
			return $this->fetch();
		}
	}
	// 文章删除
	public function article_del(){
		if(Request::instance()->isPost()){
			if(input('post.')){
				$new = new news();
				$del = $new->del_article(input('post.'));
				return $del;
			}
		}
	}
}

?>